If you do not know what you are doing, you will make stupid mistakes
The internet is full of wrong (or incomplete) information
Even very respected sources may mislead you:
Either you know very well what you are doing, or ...
The value given to parameter
lnGDP, lnCPI)UR)US_data.csvGDP)CPI)UR)GDP in the example)USdata[USdata.CPI .< 0 , :])|
|
|


No, Covid-19 did not raise the NUR; no, an increase in NUR did not anticipate Covid-19!
The loss function
To minimize the Loss function with respect to
Take the derivatives with respect to
Those derivatives are known as the First Order Conditions (FOCs).
For
For
For
And for the two right boundary conditions
The 5 FOCS that represent the optimal conditions on the left boundary, the right boundary, and the interior conditions
At the initial boundary we iterate forward, at the end boundary we iterate backwards
Matrix A non-trivial diagonals:
Check the function hp_trend in the notebook HP_IRF_2026.jl
For this point, there is no compulsory reading.
However, Dirk Krueger (2007). "Quantitative Macroeconomics: An Introduction" (Chapter 2), manuscript, Department of Economics University of Pennsylvania, is well suited for the material covered here.
This text is a small one (12 pages), easy to read, and beneficial for studying the stylized facts of business cycles, mainly to understand how the Hodrick-Prescott filter is calculated. However, notice that, as mentioned, it is not compulsory reading.